package com.centerm.common.constant.enums.task;

import com.centerm.common.constant.StatusCode;

/**
* @ClassName: TaskStatus
* @Description: 任务状态枚举
* @author Fly
* @date 2017年7月24日
 */
public enum TaskStatus implements StatusCode{
	DELETE(0, "废弃"),
	UNRECEIVE(1, "未接收"),
	RUNNING(2, "进行中"),
	HANG(3, "挂起"),
	SUBMIT(4, "提交"),
	APPLY(5, "申请延期"),
	FINISH(6, "完成"),
	DELAY(7, "超期完成"),
	;
	
	private Integer code;
	private String description;
	
	
	TaskStatus(Integer code, String description) {
		this.code = code;
		this.description = description;
	}


	@Override
	public Integer getCode() {
		return this.code;
	}


	@Override
	public String getDescription() {
		return this.description;
	}

	public static StatusCode getByCode(Integer code) {
		for(TaskStatus taskStatus : TaskStatus.values()) {
            if(taskStatus.getCode().equals(code)) {
                return taskStatus;
            }
        }
        return null;
	}


	public static String getDescriptionByCode(Integer code) {
		for(TaskStatus taskStatus : TaskStatus.values()) {
            if(taskStatus.getCode().equals(code)) {
                return taskStatus.getDescription();
            }
        }
        return null;
	}
	
}
